/**
 * 所有版权归 广西梧州 陈锦韬 所有
 *
 * @Title: Application
 * @Package com.rx
 * @Description: 程序入口
 * @author: 陈锦韬
 * @date: 2021\6\8 0008
 * @version V1.0
 * @Copyright: 2021 陈锦韬  All rights reserved.
 */
package com.rx.main;
import com.rx.core.anno.RxSpringBootApplication;
import com.rx.core.base.RxBaseConstant;
import com.rx.core.base.RxBaseSpringApplication;
import com.rx.core.util.HttpClientUtil;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * @author: Administrator
 * @Description: 程序入口
 * @date: 2021\6\8 0008
 */
/**
 * 不启动消息总线
 */
//@SpringBootApplication(exclude = BusPropertiesAutoConfiguration.class)
//@EnableEurekaClient
@RxSpringBootApplication
public class Application {


    public static int getFromHead(int[] nums, int[] values,int headFirst){
        int headIndex=0;
        int tailIndex = nums.length - 1;

        int result = 0;
        for (int i = 0;i < nums.length; i++){
            if (headFirst > 0){
                System.out.print(headIndex+" ");
                result += nums[headIndex] * values[i];
                headIndex++;
                headFirst--;
            }else {
                System.out.print(tailIndex+" ");
                result += nums[tailIndex] * values[i];
                tailIndex--;
            }
        }
        return result;
    }
    public static int getFromTail(int[] nums, int[] values,int headFirst){
        int headIndex=0;
        int tailIndex = nums.length - 1;

        int result = 0;
        for (int i = 0;i < nums.length; i++){
            if (headFirst > 0){
                System.out.print(tailIndex+" ");
                result += nums[tailIndex] * values[i];
                tailIndex--;
                headFirst--;
            }else {

                System.out.print(headIndex+" ");
                int newNums[] = new int[nums.length - headFirst];
                for(int ii = 0;ii < nums.length - headFirst;ii++){
                    newNums[ii]=nums[headIndex+ii];
                }

                result += nums[headIndex] * values[i];
                headIndex++;
            }
        }
        return result;
    }

    public static int getMax(int[] nums, int[] values){
        int result = 0;

        int tmp = 0;

        for(int i = 0; i< nums.length;i++){
            System.out.println("");
            tmp = getFromHead(nums,values,i);
            if (tmp > result){
                result = tmp;
            }
            System.out.println("");
            tmp = getFromTail(nums,values,i);
            if (tmp > result){
                result = tmp;
            }
        }

        return result;
    }
    public static int getMaxValue (int[] nums, int[] values) {
        // write code here

        if (nums == null || values == null){
            throw new RuntimeException();
        }
        if (nums.length != values.length){
            throw new RuntimeException();
        }
        int result = getMax(nums,values);




        return result;
    }

    public static void main(String[] args) {

        Map<String, String> requestUrlParam = new HashMap<>();
        requestUrlParam.put("fields1", "f1,f2,f3,f4,f5,f6");
        requestUrlParam.put("fields2", "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61");
        requestUrlParam.put("ut", "b2884a393a59ad64002292a3e90d46a5");
        requestUrlParam.put("klt", "101");
        requestUrlParam.put("fqt", "1");
        requestUrlParam.put("secid", "0.000001");
        requestUrlParam.put("beg","20220118");
        requestUrlParam.put("end","20220118");

        Map<String, String> header = new HashMap<>();
        header.put("Referer","http://www.sse.com.cn/");
        header.put("Host","query.sse.com.cn");
       String json = HttpClientUtil.doGet("https://push2his.eastmoney.com/api/qt/stock/kline/get",requestUrlParam,null);
       System.out.println(json);
    }
}
